package com.atguigu.e_map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Demo1 {
    public static void main(String[] args) {
        //创建双列集合对象
        Map<String, String> map = new HashMap<>();

        //添加元素
        map.put("乔峰","阿朱");
        map.put("段誉","王语嫣");
        map.put("虚竹","西夏公主");

        System.out.println("map = " + map);

        //召集所有的丈夫
        Set<String> keys = map.keySet();
        //遍历keys
        for (String key : keys) {
            //根据键找值
            String value = map.get(key);
            System.out.println(key +" --- "+ value);
        }
    }
}
